<?php 
$host = "localhost";
$dbname = "testitrial";
$user = "www-34";
$pwd = "mini@)!)server";
$dbConn = mysql_connect($host, $user, $pwd);
if (! $dbConn)
	die ("MySQL Connect Error");

if (! mysql_select_db($dbname, $dbConn))
	die ("MySQL Select DB Error");
$userid = 1718;
$sql1 = "SELECT * FROM blog_category WHERE mid = " . $userid . " AND topid = 0";
$rs1 = mysql_query($sql1);
$rootCate = array();
for($i=0;$row1 = mysql_fetch_array($rs1);$i++) {
	echo $row1['name'].'<br />';
	$sql2 = "SELECT * FROM blog_category WHERE mid = " . $userid . " AND topid = ".$row1['id'];
	$rs2 = mysql_query($sql2);
	for($j=0;$row2 = mysql_fetch_array($rs2);$i++) {
		echo ' - '.$row2['name'].'<br />';
		$sql3 = "SELECT * FROM blog_category WHERE mid = " . $userid . " AND topid = ".$row2['id'];
		$rs3 = mysql_query($sql3);
		for($k=0;$row3 = mysql_fetch_array($rs3);$i++) {
			echo ' -- '.$row3['name'].'<br />';
		}
	}
	echo '<br />';
}

exit();

$getAction = $_GET['action'];
$postAction = $_POST['action'];
$postpid = $_POST['pid'];
$getpid = $_GET['pid'];
$start = $_GET['start'];
$limit = $_GET['limit'];
if($getAction=='list') {
	$currentTime = date("Y-m-d H:i:s");
	$rs = MySQL_query("SELECT * FROM participant WHERE is_delete = 0");
	$totalCount = MySQL_num_rows($rs);
	//$rs = MySQL_query("SELECT * FROM participant WHERE is_delete = 0 LIMIT $start, $limit");
	$data = '"root":[';
	for($i=0;$row = mysql_fetch_array($rs);$i++) {
		if($i>=$start&&$i<$start+$limit) {
			$data .= '{"id":"'.$row[0].'", "photo":"'.$row[7].'", "pname":"'.$row[1].'", "email": "'.$row[2].'", "gender":"'.$row[3].'", "birth": "'.$row[4].'", "address": "'.$row[6].'", "mod": "'.$row[0].'"},';
		}
	}
	$data .= ']';
	
	/*
	$data = '"root":[';
	while ($row = mysql_fetch_array($rs)) {
		$data .= '{"id":"'.$row[0].'", "photo":"'.$row[6].'", "name":"'.$row[1].'", "email": "'.$row[2].'", "gender":"'.$row[3].'", "birth": "'.$row[4].'", "address": "'.$row[5].'", "mod": "'.$row[0].'"},';
	}
	$data .= ']';
	*/
	
	mysql_free_result($rs);  
	mysql_close($conn);
	echo '{"totalCount":"'.$totalCount.'",'.$data.'}';
} elseif($getAction=='edit') {
	$rs = MySQL_query("SELECT * FROM participant WHERE pid = $getpid");
	$totalCount = MySQL_num_rows($rs);
	$data = '"root":[';
	for($i=0;$row = mysql_fetch_array($rs);$i++) {
		$data .= '{"id":"'.$row[0].'", "photo":"'.$row[7].'", "pname":"'.$row[1].'", "email": "'.$row[2].'", "gender":"'.$row[3].'", "birth": "'.$row[4].'", "district_code": "'.$row[5].'", "address": "'.$row[6].'"},';
	}
	$data .= ']';
	//echo '{"totalCount":"1","items":[{"pname":"aaa", "email": "aaa@aaa.aaa"}]}';
	echo '{"totalCount":"'.$totalCount.'",'.$data.'}';
} elseif($postAction=='del') {
	mysql_query("UPDATE participant SET is_delete = 1, update_time = '$currentTime' WHERE pid = $postpid");
	echo 1;
} else
	echo 0;
?>